package cn.ydxlm.maplib.api;


import com.amap.api.services.geocoder.GeocodeResult;
import com.amap.api.services.geocoder.GeocodeSearch;
import com.amap.api.services.geocoder.RegeocodeAddress;
import com.amap.api.services.geocoder.RegeocodeResult;

public abstract class GetGeoCoderResultListener implements GeocodeSearch.OnGeocodeSearchListener {

    public abstract void onPoiResult (String province, String city, String area);


    @Override
    public void onRegeocodeSearched (RegeocodeResult regeocodeResult, int rCode) {
        if (1000 == rCode) {
            RegeocodeAddress address = regeocodeResult.getRegeocodeAddress();
            String province = address.getProvince();//省或直辖市
            String cityName = address.getCity();//地级市或直辖市
            String area = address.getDistrict();//区或县或县级市
            onPoiResult(province, cityName, area);
        } else {
            onPoiResult("", "", "");
        }
    }

    @Override
    public void onGeocodeSearched (GeocodeResult geocodeResult, int i) {

    }
}
